package com.cd468.game;

import android.animation.Animator;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.graphics.Rect;

import com.cd468.share.MovieView;
import com.cd468.share.Tool;

public class Bang  extends MovieView{

	public Bang(Context context, Rect ViewRect) {
		super(context, ViewRect);
	}
	public static void Touch(Rect ViewRect)
	{
		Bang b = new Bang(Data.sContext,ViewRect);
		b.ShowBang();
		Score.Add(Tool.Rand(8));
	}
	void ShowBang(){
        AddView(R.drawable.bang);
        Data.addView(this);        
        this.Show();
        final ObjectAnimator animBang = ObjectAnimator.ofInt(this, "Percent", 150,0);
        animBang.setDuration(1000);
        animBang.start();


        animBang.addListener(new Animator.AnimatorListener() {
            @Override
            public void onAnimationStart(Animator animation) {

            }

            @Override
            public void onAnimationEnd(Animator animation) {
            	
            	Data.removeView(Bang.this);
            	
            }

            @Override
            public void onAnimationCancel(Animator animation) {

            }

            @Override
            public void onAnimationRepeat(Animator animation) {

            }
        });
    }

}
